let app = getApp();
import {Base64Img} from '../../static/base64Img/Base64Img';
import {util} from '../../utils/util';

Component({
    options: {
        addGlobalClass: true
    },
    mixins: [],
    data: {
        iam_total: 0,
        iam_confim: 0,
        iam_lastSubmitTime: '',
        al_total: 0,
        al_confim: 0,
        al_lastSubmitTime: '',
        paph_total: 0,
        paph_confim: 0,
        paph_lastSubmitTime: '',
        artistic_total: 0,
        artistic_confim: 0,
        artistic_lastSubmitTime: '',
        sp_total: 0,
        sp_confim: 0,
        sp_lastSubmitTime: '',
        si_total: 0,
        si_confim: 0,
        si_lastSubmitTime: '',
        info: [],
        sxbk: Base64Img.sxbk,
        xybk: Base64Img.xybk,
        sxjkbk: Base64Img.sxjkbk,
        ysbk: Base64Img.ysbk,
        shbk: Base64Img.shbk,
        tsbk: Base64Img.tsbk,

    },
    lifetimes: {
        attached: function () {
            this.getStudentIndex();
        },
        detached: function () {
            // 在组件实例被从页面节点树移除时执行
        },
    },
    pageLifetimes: {
        // 组件所在页面的生命周期函数
        show: function () {
            this.getStudentIndex();
        },
        hide: function () {
            console.log("111111111111111111111111111111---------------------------------");
        },
        resize: function () {
            console.log("22222222222222222222222222222222----------------------------------");
        },
    },
    props: {},

    methods: {
        //获取学生列表首页数据
        getStudentIndex() {
            var me = this;
            //调用钉钉端接口,获取学生首页地址
            wx.request({
                url: app.ZsServerAddress + '/facts/getStudentIndex',
                method: 'POST',
                dataType: 'json',
                header: {
                    'Content-Type': 'application/x-www-form-urlencoded',
                    'Authorization': 'Bearer ' + app.token,
                },
                success: function (res) {
                    wx.stopPullDownRefresh()
                    if (res.data.code == 0) {

                        me.setData({
                            iam_total: res.data.info.iam['total'],
                            iam_confim: res.data.info.iam['confim'],
                            iam_lastSubmitTime: res.data.info.iam['lastSubmitTime'] || '您未上报此类型写实',
                            al_total: res.data.info.al['total'],
                            al_confim: res.data.info.al['confim'],
                            al_lastSubmitTime: res.data.info.al['lastSubmitTime'] || '您未上报此类型写实',
                            paph_total: res.data.info.paph['total'],
                            paph_confim: res.data.info.paph['confim'],
                            paph_lastSubmitTime: res.data.info.paph['lastSubmitTime'] || '您未上报此类型写实',
                            artistic_total: res.data.info.art['total'],
                            artistic_confim: res.data.info.art['confim'],
                            artistic_lastSubmitTime: res.data.info.art['lastSubmitTime'] || '您未上报此类型写实',
                            sp_total: res.data.info.sp['total'],
                            sp_confim: res.data.info.sp['confim'],
                            sp_lastSubmitTime: res.data.info.sp['lastSubmitTime'] || '您未上报此类型写实',
                            si_total: res.data.info.si['total'],
                            si_confim: res.data.info.si['confim'],
                            si_lastSubmitTime: res.data.info.si['lastSubmitTime'] || '您未上报此类型写实',
                        })

                    } else {
                        util.showError(res.data.message)
                    }
                },
                fail: function (res) {
                    util.showError(res)
                }
            });

        },

        sxpdXssb() {
            console.log("---------------------1");
            wx.navigateTo({
                url: '/pages/create/index?type=0'   //跳转至思想品德上报
            })
        },
        xyspXssb() {
            console.log("---------------------2");
            wx.navigateTo({
                url: '/pages/create/index?type=1'   //跳转至学业水平
            })
        },
        sxjkXssb() {
            console.log("---------------------3");
            wx.navigateTo({
                url: '/pages/create/index?type=2'   //跳转至身心健康
            })

        },
        yssyXssb() {
            console.log("---------------------4");
            wx.navigateTo({
                url: '/pages/create/index?type=3'   //跳转至艺术素养           
            })
        },
        shsjXssb() {
            console.log("---------------------5");
            wx.navigateTo({
                url: '/pages/create/index?type=4'   //跳转至社会实践
            })
        },
        tsxmXssb() {
            console.log("---------------------6");
            wx.navigateTo({
                url: '/pages/create/index?type=5'   //跳转至特色项目
            })
        },

        sxpdCkjl() {
            console.log("---------------------1");
            wx.navigateTo({
                url: '/pages/stu-list/detail/index?type=0'   //跳转至思想品德学生实例列表
            })
        },
        xyspCkjl() {
            console.log("---------------------2");
            wx.navigateTo({
                url: '/pages/stu-list/xysp/xysp?type=1'   //跳转至学业水平
            })
        },
        sxjkCkjl() {
            console.log("---------------------3");
            wx.navigateTo({
                url: '/pages/stu-list/sxjk/sxjk?type=2'   //跳转至身心健康
            })

        },
        yssyCkjl() {
            console.log("---------------------4");
            wx.navigateTo({
                url: '/pages/stu-list/yssy/yssy?type=3'   //跳转至艺术素养

            })
        },
        shsjCkjl() {
            console.log("---------------------5");
            wx.navigateTo({
                url: '/pages/stu-list/shsj/shsj?type=4'   //跳转至 社会实践
            })
        },
        tsxmCkjl() {
            console.log("---------------------6");
            wx.navigateTo({
                url: '/pages/stu-list/tsxm/tsxm?type=5'   //跳转至特色项目           
            })
        }

    },
});
